import json
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse
from .models import Entry
# Create your views here.
@csrf_exempt
def new_log(req,code):
    m = json.loads(req.body.decode('utf-8'))
    model = Entry()
    model.__dict__.update(m)
    model.code = code
    model.save()
    return JsonResponse({}, safe=False)